package com.shioirikukuri.service.impl;

import com.shioirikukuri.entity.Gift;
import com.shioirikukuri.mapper.GiftMapper;
import com.shioirikukuri.service.IGiftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GiftServiceImpl implements IGiftService {

	@Autowired
	private GiftMapper giftMapper;

	@Override
	public Gift addGift(Gift gift) {
		giftMapper.insert(gift);
		return gift;
	}

	@Override
	public Gift getGiftById(Long id) {
		return giftMapper.findById(id);
	}

	@Override
	public List<Gift> getAllGifts() {
		return giftMapper.findAll();
	}

	@Override
	public void updateGift(Gift gift) {
		giftMapper.update(gift);
	}

	@Override
	public void deleteGift(Long id) {
		giftMapper.deleteById(id);
	}
}
